﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content;

namespace Sublimation
{
    public abstract class MenuItem : GameObject
    {
        protected String text;
        protected float rotationAngle = 0.0f;
        protected MenuItemStatus itemStatus;
        protected Texture2D towerbottom;
        protected Texture2D towertop;
        protected Color towerColor;
        public Color TowerColor
        {
            get { return towerColor; }
            set { towerColor = value; }
        }


        public MenuItem(WorldProperties worldProperties, String text)
            : base(worldProperties)
        {
            this.text = text;
            Scale = 1.0f;
            towerColor = Color.White;
            DrawOrder = 61;
        }


        #region GameObject implementation

        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);
        }

        protected override void LoadContent()
        {
            base.LoadContent();
            sprite = Game.Content.Load<Texture2D>("MenuTowerItem");
            towerbottom = Game.Content.Load<Texture2D>("Sprites/tower_bottom");
            towertop = Game.Content.Load<Texture2D>("Sprites/tower_top");
            
        }


        public override void Draw(GameTime gameTime)
        {
            base.Draw(gameTime);
            if (Sprite != null)
            {
                spriteBatch.Begin(SpriteBlendMode.AlphaBlend);
                // draw tower sprites with scaled down 0.7
                spriteBatch.Draw(towerbottom, Position, null, towerColor, Rotation, Origin, 0.7f, SpriteEffects.None, 1.0f);
                spriteBatch.Draw(towertop, Position, null, towerColor, Rotation, Origin, 0.7f, SpriteEffects.None, 1.0f);
                spriteBatch.End();
            }
        }


        #endregion

        #region get/set methods

        public MenuItemStatus ItemStatus
        {
            get { return itemStatus; }
            set { itemStatus = value; }
        }
        public String Text
        {
            get { return text; }
            set { text = value; }
        }

        public float RotationAngle
        {
            get { return rotationAngle; }
            set { rotationAngle = value; }
        }


        #endregion
    }
}

